<template>
	<view>
		<view class="cardShadow">
			<view class="title">
				<text v-if="item.human_type === '1'">{{ item[$t('item.goods_name')] || $t("暂无信息") }}</text>
				<text v-if="item.human_type === '2'">
					{{$t("可发货物")}}: {{ item[$t('item.goods_name')] || $t("暂无信息") }}
				</text>
			</view>

			<view class="lineP">
				<view style="flex: 1;">
					<!-- <view class="lineP">
						<text v-if="item.human_type === '1'" class="red fontWeight">{{ $t('货源信息') }}</text>
						<text v-else-if="item.human_type === '2'" class="black fontWeight"
							:class="type == 2 ? 'green':''">{{ $t('我要带货') }}</text>
					</view> -->
					<view class="lineP">
						<view class="label" v-if="item.human_type === '1'">
							<text v-if="type==1">{{$t("运费出价")}}</text>
							<text v-if="type==2">{{$t("期望运费")}}</text>		
						</view>
						<view class="label" v-if="item.human_type === '2'">
							<text v-if="type==1">{{$t("运费出价")}}</text>
							<text v-if="type==2">{{$t("期望运费")}}</text>		
						</view>
						<view class="price">
							{{item.desire_price}}
							<text>{{$t(item.price_unit)}}/kg</text>
						</view>
					</view>
					<view class="lineP" v-if="item.human_type === '1'">
						<Tag :text="item[$t('item.goods_weight')]+'kg'" color="#2b7deb"></Tag>
						<Tag :text="item[$t('item.goods_volume')]+'m³'" color="#ef9b17"></Tag>
					</view>

					<view class="lineP u-margin-bottom-0">
						<FromToCountry :item="item"></FromToCountry>
					</view>
				</view>
				<view class="carPicture">
					<img v-if="item.human_type === '1'" :src="HTTP_IMG_UTL+'transportIcon2.png'" alt="" />
					<img v-if="item.human_type === '2'" :src="HTTP_IMG_UTL+'transportIcon3.png'" alt="" />
				</view>
				
			</view>


			<view class="lineP">
				<img :src="HTTP_IMG_UTL+'location.png'" class="headline_img" />
				<view class="u-flex-1">{{item.hyd || $t("暂无信息") }}</view>
			</view>
			<view class="lineP">
				<img :src="HTTP_IMG_UTL+'transportIcon1.png'" class="headline_img" />
				<view class="u-flex-1">{{item.shd || $t("暂无信息") }}</view>
			</view>
			<view class="lineP">
				<TransportType :item="item"></TransportType>
			</view>
		</view>
		<view class="cardShadow" style="margin-top:20rpx;" v-if="item.human_type === '1'">
			<ProductWHL :item="item" :type="type"></ProductWHL>
		</view>
	</view>
</template>

<script>
	import TransportType from '@/components/TransportType.vue'
	
	import {
		createC2CConversation,
		isBase64,
		time
	} from "@/common/public";
	import FromToCountry from '@/components/FromToCountry.vue'

	import Tag from '@/components/Tag.vue'
	import ProductWHL from '@/components/ProductWHL.vue'
	
	import {
		IMAGE_URL,
		HTTP_IMG_UTL
	} from "@/config/app";
	export default {
		components: {
			Tag,TransportType,
			FromToCountry,
			ProductWHL
		},
		props: {
			item: {
				type: Object,
				default: {},
			},
			type: {
				type: String,
				default: '1',
			},
		},
		computed: {
			toImages() {
				return (src) => {
					return isBase64(src) ? src : IMAGE_URL + src
				}
			},
		},
		data() {
			return {
				HTTP_IMG_UTL
			};
		},
		methods: {
			time
		}
	}
</script>

<style lang="scss" scoped>
	.carPicture {
		bottom: 39%;
		right: 20rpx;

		img {
			height: 160rpx;
			width: 200rpx;
		}
	}

	.lineP {
		display: flex;
		align-items: center;
		margin-bottom: 8px;
		position: relative;
		font-size: 16px;
		flex-wrap: wrap;

		&.shot {
			width: 48%;
			flex-wrap: wrap;

			.tag {
				margin-top: 20rpx;
			}
		}

		.fontWeight {
			font-weight: 600;
		}

		.red {
			color: #e33a13;
		}

		.black {
			color: #000;
		}

		.green {
			color: #0bb30e;
		}



		.headline_img {
			width: 30rpx;
			height: 30rpx;
			margin-right: 10rpx;
		}

		.label {
			font-weight: 600;
			margin-bottom: 10rpx;
			flex: 0 0 100%;
		}

		.price {
			color: #ee1c25;
			font-size: 40rpx;
			font-weight: 600;

			text {
				font-size: 28rpx;
			}
		}
	}

	.title {
		color: #e43b14;
		text-align: center;
		font-size: 38rpx;
		font-weight: 600;
		margin-top: 10rpx;
		word-break: break-all;
		min-height: 80rpx;
		margin-bottom: 20rpx;
	}
</style>